package com.woniuxy.springparking.controller;


import com.woniuxy.springparking.asepct.SysLog;
import com.woniuxy.springparking.domain.TreeNode;
import com.woniuxy.springparking.pojo.User;
import com.woniuxy.springparking.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
public class IndexController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/index.do")
    public String index() {

        return "index";
    }

    @RequestMapping(value = "/loadIndexLeftMenu.do")
    @ResponseBody
    public List<TreeNode> loadIndexLeftMenu() {
        Subject subject = SecurityUtils.getSubject();
        Session session = subject.getSession();
        User user = (User) session.getAttribute("USER_SESSION");
        List<TreeNode> treeNodes = userService.selectMenusByUid(user.getId());
        return treeNodes;
    }

    @RequestMapping(value = "toLog.do")
    @SysLog(value1 = "查询",value2 = "查询日志信息")
    public String toUserManager() {
        return "log/log";
    }

    @RequestMapping(value = "toMerchantUser.do")
    @SysLog(value1 = "查询",value2 = "查询商户账号信息")
    public String toMerchantUser() {
        return "merchants/merchant_users";
    }

    @RequestMapping(value = "tMerchantUserCheck.do")
    @SysLog(value1 = "查询",value2 = "查询商户认证信息")
    public String toAssignRole() {
        return "merchants/merchant_users_check";
    }

    @RequestMapping(value = "toPerOrder.do")
    @SysLog(value1 = "查询",value2 = "查询订单信息")
    public String toPerOrder() {
        return "order/perOrder";
    }

    @RequestMapping(value = "/toOverOrder.do")
    @SysLog(value1 = "查询",value2 = "查询超时订单信息")
    public String toAssignRight() {
        return "order/overOrder";
    }

    @RequestMapping(value = "toPerFaceback.do")
    @SysLog(value1 = "查询",value2 = "查询用户投诉信息")
    public String toPermissionManager() {
        return "complain/perFaceback";
    }

    @RequestMapping(value = "/toPerOrderDetails.do")
    @SysLog(value1 = "查询",value2 = "查询订单详细信息")
    public String ttoPerOrderDetails() {
        return "order/perOrderDetails";
    }

    @RequestMapping("/toOverOrderDetails.do")
    @SysLog(value1 = "查询",value2 = "查询超时订单详细信息")
    public String toOverOrderDetails() {
        return "order/overOrderDetails";
    }

    @RequestMapping("toDealComplain.do")
    public String toDealComplain() {
        return "complain/dealComplain";
    }

    @RequestMapping("toCoupon.do")
    @SysLog(value1 = "查询",value2 = "查询代金券信息")
    public String toCoupon() {
        return "voucher/coupon";
    }

    @RequestMapping("toSetCoupon.do")
    public String toSetCoupon() {
        return "voucher/setCoupon";
    }

    @RequestMapping("toAddCoupon.do")
    public String toAddCoupon() {
        return "voucher/addCoupon";
    }

    @RequestMapping("toTPUser.do")
    @SysLog(value1 = "查询",value2 = "查询用户信息")
    public String toTPUser() {
        return "user/t_per_users";
    }

    @RequestMapping("toTPerUserCheck.do")
    @SysLog(value1 = "查询",value2 = "查询用户认证信息")
    public String toTPerUserCheck() {
        return "user/t_per_users_check";
    }

    @RequestMapping("toMerchantParking.do")
    @SysLog(value1 = "查询",value2 = "查询商户车位信息")
    public String toMerchantParking() {
        return "parkingSpace/merchantParking";
    }

    @RequestMapping("toUserParking.do")
    @SysLog(value1 = "查询",value2 = "查询用户车位信息")
    public String toUserParking() {
        return "parkingSpace/userParking";
    }

    @RequestMapping("toindexMod.do")
    @SysLog(value1 = "查询",value2 = "查询商户车位信息")
    public String toindexMod() {
        return "parkingSpace/modal/indexMod";
    }

    @RequestMapping("toUserMod.do")
    @SysLog(value1 = "查询",value2 = "查询用户车位信息")
    public String toUserMod() {
        return "parkingSpace/modal/userMode";
    }


//    @RequestMapping("toOrdersLineList.do")
//    public String toOrdersLineList() {
//        return "ordersLine/ordersLineList";
//    }
//
//    @RequestMapping("toCustLostManager.do")
//    public String toCustLostManager() {
//        return "lost/lostList";
//    }
//
//    @RequestMapping("toLostSavePage.do")
//    public String toLostSavePage() {
//        return "lost/lostSave";
//    }
//
//    @RequestMapping("toLostPage.do")
//    public String toLostPage() {
//        return "lost/lost";
//    }
//
//    @RequestMapping(value = "/toUserLevel.do")
//    public String totoUserLevel() {
//        return "user/userLevel";
//    }
//
//    @RequestMapping(value = "/toLevel.do")
//    public String toLevel() {
//        return "user/toLevel";
//    }
//
//    @RequestMapping(value = "/toLevelEidtPage.do")
//    public String toLevelEidtPage() {
//        return "user/toLevelEidtPage";
//    }
//
//    @RequestMapping("/toProduct.do")
//    public String toProduct() {
//        return "product/productlist";
//    }
//
//    @RequestMapping("/toStock.do")
//    public String toStock() {
//        return "stock/stock";
//    }
//
//    @RequestMapping("/toCustomer.do")
//    public String toCustomer() {
//        return "stock/customer";
//    }
//
//    @RequestMapping("/toLostPie.do")
//    public String toLostPie() {
//        return "lost/lostPie";
//    }
//
//    @RequestMapping(value = "toServiceAddManager.do")
//    public String toServiceAddManage() {
//        return "service/serviceAdd";
//    }
//
//    @RequestMapping(value = "toServiceDistributeManager.do")
//    public String toServiceDistributeManager() {
//        return "service/serviceDistribute";
//    }
//
//    @RequestMapping(value = "toServiceDealManager.do")
//    public String toServiceDealManager() {
//        return "service/serviceDeal";
//    }
//
//    @RequestMapping(value = "toAssignPeople.do")
//    public String toAssignPeople() {
//        return "service/assignPeople";
//    }
//
//    @RequestMapping(value = "toServiceDealEdit.do")
//    public String toServiceDealEdit() {
//        return "service/serviceDealEdit";
//    }
//
//    @RequestMapping(value = "toServiceResponseManager.do")
//    public String toServiceResponseManager() {
//        return "service/serviceResponse";
//    }
//
//    @RequestMapping(value = "toServiceResponseEdit.do")
//    public String toServiceResponseEdit() {
//        return "service/serviceResponseEdit";
//    }
//
//    @RequestMapping(value = "toServiceFileManager.do")
//    public String toServiceFileManager() {
//        return "service/serviceFile";
//    }
//
//    @RequestMapping(value = "toServiceFileEdit.do")
//    public String toServiceFileEdit() {
//        return "service/serviceFileEdit";
//    }
//
//    @RequestMapping("toRoleEditPage.do")
//    public String toRolesEditPage() {
//        return "role/roleEdit";
//    }
//
//    @RequestMapping("toRoleAddPage.do")
//    public String toRoleAddPage() {
//        return "role/roleAdd";
//    }
//
//    @RequestMapping("toPermissionEditPage.do")
//    public String toPermissionEditPage() {
//        return "permission/permissionEdit";
//    }
//
//    @RequestMapping(value = "toServiceAnalyse.do")
//    public String toServiceAnalyse() {
//        return "service/serviceAnalyse";
//    }
//
//    @RequestMapping("/changepsw.do")
//    public String changepsw(User user) {
//        return "user/changepsw";
//    }
//
//    @RequestMapping(value = "toUserManager1.do")
//    public String toUserManager1() {
//        return "user/userList2";
//    }
}